<%if current_user.got_challenges.size > 0 %>
<div class="challenge-notification">
<center>
<table width=100%> 
  <%current_user.got_challenges.each do |ch|%>
    <%match = ch.match%>
    <%next if Time.now > match.begin_at%>
    <%match_not_placed =  current_user.bets.map{|b| b.match_id}.include?(ch.match_id.to_i)%>
   <tr id='ch_<%=ch.id%>'>
     <td style="text-align:center;">
	<%if !match_not_placed%>
          <%=ch.sender.name%> sent you a <%=ch.amount%> WinPoints challenge
          <%=link_to " Accept Challenge and place bet ","#",:onclick=>"showDialog('#{@call_back_url + "/friends_bet/gen_dialog?sid=" + match.id.to_s + "&uid=" + ch.sender.id.to_s + "&chid=" + ch.id.to_s}');return false" if Time.now < match.begin_at%></span>
	<%else%>
	   <%=render :partial=>'friends_bet/ch_wait_accept',:locals=>{:ch=>ch,:u=>ch.sender}%>
	<%end%>
     </td>
   </tr>

  <%end%>
</table>
</center>
</div>
<%end%>
